<!DOCTYPE html>
<html>
  <head>
  <meta charset='UTF-8'>
  <title>Atom API Documentation</title>
  <link rel='stylesheet' href='../assets/biscotto.css' type='text/css'>
  <script src='../assets/biscotto.js'></script>
  <script src='../assets/search_data.js'></script>
</head>
  <body>
    <div id='base' data-path='..&#47;'></div>
<div id='header'>
  <div id='menu'>
    <a href='../docs/README.md.html' title='Atom'>Atom</a>
    &raquo;
    <a href='../class_index.html' title='Index'>Index</a>
    &raquo;
    <span class='title'>Range</span>
    <nav>
      <ul>
        <li class='noframes'>
          (<a class='noframes' href='Range.html#'>no frames</a>)
        </li>
      </ul>
    </nav>
    <div id='search'>
      <a id='class_list_link' href='../class_list.html'>Classes</a>
      <a id='file_list_link' href='../file_list.html'>Files</a>
      <a id='method_list_link' href='../method_list.html'>Methods</a>
      <a id='extra_list_link' href='../extra_list.html'>Extras</a>
    </div>
  </div>
  <iframe id='search_frame'></iframe>
  <div id='fuzzySearch'>
    <input type='text'>
    <ol></ol>
  </div>
  <div id='help'>
    <p>
      Quickly fuzzy find classes, mixins, methods, file:
    </p>
    <ul>
      <li>
        <span>Ctrl-T</span>
        Open fuzzy finder dialog
      </li>
    </ul>
    <p>
      In frame mode you can toggle the list naviation frame on the left side:
    </p>
    <ul>
      <li>
        <span>Ctrl-L</span>
        Toggle list view
      </li>
    </ul>
    <p>
      You can focus a list in frame mode or toggle a tab in frameless mode:
    </p>
    <ul>
      <li>
        <span>Ctrl-C</span>
        Class list
      </li>
      <li>
        <span>Ctrl-I</span>
        Mixin list
      </li>
      <li>
        <span>Ctrl-F</span>
        File list
      </li>
      <li>
        <span>Ctrl-M</span>
        Method list
      </li>
      <li>
        <span>Ctrl-E</span>
        Extras list
      </li>
    </ul>
    <p>
      You can focus and blur the search input:
    </p>
    <ul>
      <li>
        <span>Ctrl-S</span>
        Focus search input
      </li>
      <li>
        <span>Esc</span>
        Blur search input
      </li>
    </ul>
    <p>
      In frameless mode you can close the list tab:
    </p>
    <ul>
      <li>
        <span>Esc</span>
        Close list tab
      </li>
    </ul>
  </div>
</div>
    <div id='content'>
      <h1>
        Class
        Range
      </h1>
      <div class='stability-1'>
        <span class='heading'></span>
        <div class='message'></div>
      </div>
      <table class='box'>
        <tr>
          <td>Defined in:</td>
          <td>docs&#47;includes&#47;text-buffer&#47;src&#47;range.coffee</td>
        </tr>
      </table>
      <h2>Overview</h2>
      <div class='docstring'>
  <p>Represents a region in a buffer in row/column coordinates.</p><p>Every public method that takes a range also accepts a <em>range-compatible</em>
<a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a>. This means a 2-element array containing <a href='Point.html'>Point</a>s or point-compatible
arrays. So the following are equivalent:</p><pre><code class="lang-coffee">new Range(new Point(0, 1), new Point(2, 3))
new Range([0, 1], [2, 3])
[[0, 1], [2, 3]]
</code></pre>

</div>
<div class='tags'>
</div>
      <h2>Class Method Summary</h2>
      <ul class='summary'>
  <li>
    <span class='signature'>
      <a href='Range.html#deserialize-class'>
        .<strong>deserialize</strong>(array)
      </a>
    </span>
    <span class='desc'>
      Call this with the result of <a href='Range.html#serialize-instance'>Range::serialize</a> to construct a new Range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#fromObject-class'>
        Range .<strong>fromObject</strong>(object, copy)
      </a>
    </span>
    <span class='desc'>
      Convert any range-compatible object to a <a href='Range.html'>Range</a>.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#fromPointWithDelta-class'>
        Range .<strong>fromPointWithDelta</strong>(startPoint, rowDelta, columnDelta)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='Range.html'>Range</a> that starts at the given point and ends at the start point plus the given row and column deltas.
    </span>
  </li>
</ul>
      <h2>Instance Method Summary</h2>
      <ul class='summary'>
  <li>
    <span class='signature'>
      <a href='Range.html#compare-instance'>
        ::<strong>compare</strong>(other)
      </a>
    </span>
    <span class='desc'>
      <ul>other: A <a href='Range.html'>Range</a> or range-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a>.
</ul>

    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#containsPoint-instance'>
        ::<strong>containsPoint</strong>(point, exclusive)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range contains the given point.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#containsRange-instance'>
        ::<strong>containsRange</strong>(otherRange, exclusive)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range contains the given range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#copy-instance'>
        ::<strong>copy</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a new range with the same start and end positions.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#coversSameRows-instance'>
        ::<strong>coversSameRows</strong>(other)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range starts and ends on the same row as the argument.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#freeze-instance'>
        ::<strong>freeze</strong>()
      </a>
    </span>
    <span class='desc'>
      Freezes the range and its start and end point so it becomes immutable and returns itself.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#getRowCount-instance'>
        Number ::<strong>getRowCount</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the number of rows in this range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#getRows-instance'>
        ::<strong>getRows</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns an array of all rows in the range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#intersectsRow-instance'>
        ::<strong>intersectsRow</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range intersects the given row <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#intersectsRowRange-instance'>
        ::<strong>intersectsRowRange</strong>(startRow, endRow)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range intersects the row range indicated by the given startRow and endRow <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>s.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#intersectsWith-instance'>
        ::<strong>intersectsWith</strong>(otherRange)
      </a>
    </span>
    <span class='desc'>
      Determines whether this range intersects with the argument.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#isEmpty-instance'>
        Boolean ::<strong>isEmpty</strong>()
      </a>
    </span>
    <span class='desc'>
      Is the start position of this range equal to the end position?
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#isEqual-instance'>
        ::<strong>isEqual</strong>(other)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range has the same start and end points as the given <a href='Range.html'>Range</a> or range-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a>.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#isSingleLine-instance'>
        ::<strong>isSingleLine</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range starts and ends on the same row.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#serialize-instance'>
        ::<strong>serialize</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a plain javascript object representation of the range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#toString-instance'>
        ::<strong>toString</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a string representation of the range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='Range.html#union-instance'>
        ::<strong>union</strong>(otherRange)
      </a>
    </span>
    <span class='desc'>
      Returns a new range that contains this range and the given range.
    </span>
  </li>
</ul>
      <h2>Class Method Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='deserialize-class'>
      .<strong>deserialize</strong>(array)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Call this with the result of <a href='Range.html#serialize-instance'>Range::serialize</a> to construct a new Range.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='fromObject-class'>
      Range .<strong>fromObject</strong>(object, copy)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Convert any range-compatible object to a <a href='Range.html'>Range</a>.</p><ul>
<li>object:
This can be an object that&#39;s already a <a href='Range.html'>Range</a>, in which case it&#39;s
simply returned, or an array containing two <a href='Point.html'>Point</a>s or point-compatible
arrays.</li>
<li>copy:
An optional boolean indicating whether to force the copying of objects
that are already ranges.</li>
</ul>

</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns: A <a href='Range.html'>Range</a> based on the given object.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='fromPointWithDelta-class'>
      Range .<strong>fromPointWithDelta</strong>(startPoint, rowDelta, columnDelta)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='Range.html'>Range</a> that starts at the given point and ends at the start point plus the given row and column deltas.</p><ul>
<li>startPoint:
A <a href='Point.html'>Point</a> or point-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a></li>
<li>rowDelta:
A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> indicating how many rows to add to the start point to get the
end point.</li>
<li>columnDelta:
A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> indicating how many rows to columns to the start point to get
the end point.</li>
</ul>

</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Range.html'>Range</a></span>
    </li>
  </ul>
</div>
  </div>
</div>
      <h2>Instance Method Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='compare-instance'>
      ::<strong>compare</strong>(other)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <ul>
<li>other: A <a href='Range.html'>Range</a> or range-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a>.</li>
</ul>

</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      <span class='desc'>Returns:
* -1 if this range starts before the argument or contains it
* 0 if this range is equivalent to the argument.
* 1 if this range starts after the argument or is contained by it.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='containsPoint-instance'>
      ::<strong>containsPoint</strong>(point, exclusive)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range contains the given point.</p><ul>
<li>point: A <a href='Point.html'>Point</a> or point-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a></li>
<li>exclusive:
A boolean value including that the containment should be exclusive of
endpoints. Defaults to false. </li>
</ul>

</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='containsRange-instance'>
      ::<strong>containsRange</strong>(otherRange, exclusive)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range contains the given range.</p><ul>
<li>otherRange: A <a href='Range.html'>Range</a> or range-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a></li>
<li>exclusive:
A boolean value including that the containment should be exclusive of
endpoints. Defaults to false. </li>
</ul>

</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='copy-instance'>
      ::<strong>copy</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a new range with the same start and end positions.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='coversSameRows-instance'>
      ::<strong>coversSameRows</strong>(other)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range starts and ends on the same row as the argument.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='freeze-instance'>
      ::<strong>freeze</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Freezes the range and its start and end point so it becomes immutable and returns itself.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getRowCount-instance'>
      Number ::<strong>getRowCount</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the number of rows in this range.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getRows-instance'>
      ::<strong>getRows</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns an array of all rows in the range.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='intersectsRow-instance'>
      ::<strong>intersectsRow</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range intersects the given row <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='intersectsRowRange-instance'>
      ::<strong>intersectsRowRange</strong>(startRow, endRow)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range intersects the row range indicated by the given startRow and endRow <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>s.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='intersectsWith-instance'>
      ::<strong>intersectsWith</strong>(otherRange)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Determines whether this range intersects with the argument.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='isEmpty-instance'>
      Boolean ::<strong>isEmpty</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Is the start position of this range equal to the end position?</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Boolean</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='isEqual-instance'>
      ::<strong>isEqual</strong>(other)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range has the same start and end points as the given <a href='Range.html'>Range</a> or range-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a>.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='isSingleLine-instance'>
      ::<strong>isSingleLine</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether this range starts and ends on the same row.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='serialize-instance'>
      ::<strong>serialize</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a plain javascript object representation of the range.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='toString-instance'>
      ::<strong>toString</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a string representation of the range.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='union-instance'>
      ::<strong>union</strong>(otherRange)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a new range that contains this range and the given range.</p>
</div>
<div class='tags'>
</div>
  </div>
</div>
    </div>
    <div id='footer'>
  Generated on
  Thu Feb 27 2014 16:02:52 GMT-0800 (PST)
  by
  <a href='https://github.com/gjtorikian/biscotto' title='TomDoc-CoffeeScript API documentation generator'>Biscotto</a>
  v2.1.0
  (Node.js v0.10.21).
  &#10034;
  Press Ctrl-h to see the keyboard shortcuts
</div>
  </body>
</html>